package com.wpf.hf.controller;

import com.wpf.hf.entity.Result;
import com.wpf.hf.pojo.Order;
import com.wpf.hf.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @GetMapping("/findOrderList/{username}")
    public Result<List<Order>> findOrderList(@PathVariable("username") String username){
        List<Order> orderList = orderService.findOrderByUserId(username);
        int i = 1/0;
        return new Result<List<Order>>(true,"查询成功",orderList);
    }
}
